
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

import java.util.concurrent.TimeUnit;
public class usebrowser {
    public static WebDriver driver;
    public WebDriver StartChrome(String url) throws Exception {
        try {
            // 设置浏览器驱动路径
            System.setProperty("webdriver.chrome.driver", "chromedriver128.exe");
            // 初始化Chrome浏览器
            driver = new ChromeDriver();
            // 打开艾斯医药商务系统首页
            driver.get(url);
            System.out.println("成功打开谷歌浏览器！");
            driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
        } catch (Exception e) {
            System.out.println("打开谷歌浏览器时出错了" + e);
        }
        return driver;
    }
}